{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Load Data**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "df = pd.read_csv('C:/Users/irene/Downloads/T1.csv')\n",
    "new_data = df.dropna(axis = 0, how ='any')\n",
    "new_data.describe()\n",
    "cap=max(new_data['LV ActivePower (kW)'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Parameter Settings**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "i=[1,2] #for fold-1\n",
    "look_back=6\n",
    "data_partition=0.4863039877691426"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from myfunctions import svr_model,ann_model,rf_model,lstm_model,emd_lstm,eemd_lstm,ceemdan_lstm,proposed_method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "CUDA_VISIBLE_DEVICES=\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    5.00804\n",
      "RMSE 269.3157865146216\n",
      "MAE 181.22759958572158\n"
     ]
    }
   ],
   "source": [
    "svr_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 4.7110996879410445\n",
      "RMSE 275.4689743407588\n",
      "MAE 170.48211483042985\n"
     ]
    }
   ],
   "source": [
    "ann_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    5.359112\n",
      "RMSE 293.9292126500068\n",
      "MAE 193.93196048455715\n"
     ]
    }
   ],
   "source": [
    "rf_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 3.7378522841191524\n",
      "RMSE 245.92624143461885\n",
      "MAE 135.26289073260645\n"
     ]
    }
   ],
   "source": [
    "lstm_model(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    2.341043\n",
      "RMSE 170.53786841779225\n",
      "MAE 84.7160816323981\n"
     ]
    }
   ],
   "source": [
    "emd_lstm(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    1.934498\n",
      "RMSE 132.27249819085668\n",
      "MAE 70.0043020920575\n"
     ]
    }
   ],
   "source": [
    "eemd_lstm(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    1.714492\n",
      "RMSE 121.97688944762845\n",
      "MAE 62.04287867265737\n"
     ]
    }
   ],
   "source": [
    "ceemdan_lstm(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MAPE 0    1.374696\n",
      "RMSE 90.90242312624707\n",
      "MAE 49.74658786065946\n"
     ]
    }
   ],
   "source": [
    "proposed_method(new_data,i,look_back,data_partition,cap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
